{% load reviews_tags %}
{% load i18n %}

<article class="review">
    <header>
        <h3 class="star-rating {{ review.score|as_stars }}">
            <i class="icon-star"></i>
            <i class="icon-star"></i>
            <i class="icon-star"></i>
            <i class="icon-star"></i>
            <i class="icon-star"></i>
            <a href="{{ review.get_absolute_url }}">{{ review.title }} <span>{{ review.score }}</span></a>
        </h3>
    </header>

    {{ review.body.strip|linebreaks }}

    <div class="row-fluid">
        <div class="span6 review_content">
            <div>
                <p>
                    <small>
                        {% blocktrans with name=review.get_reviewer_name %}
                        Reviewed by <strong>{{ name }}</strong> on 
                        {% endblocktrans %} <br/>
                        <a href="{% url catalogue:reviews-detail product.slug product.pk review.pk %}">{{ review.date_created }}</a>
                    </small>
                </p>
            </div>
        </div>
        <div class="span6 review_votes">
            <div>
                {% if request.user.is_authenticated %}
                    <p><small>{% trans "Is this review helpful?" %}</small></p>
                    <form action="{{ review.get_absolute_url }}" method="post" class="vote_agree" >
                        {% csrf_token %}
                        <input type="hidden" name="delta" value="1"/>
                        <button type="submit" class="btn btn-info btn-small">{% trans "Yes" %}</button>
                    </form>
                    <form  action="{{ review.get_absolute_url }}" method="post">
                        {% csrf_token %}
                        <input type="hidden" name="delta" value="-1"/>
                        <button type="submit" class="btn btn-info btn-small">{% trans "No" %}</button>
                    </form>
                {% endif %}

                {% if review.has_votes %}
                    <p>
                        <small>
                        {% blocktrans count review.num_up_votes as num_up_votes %}
                        <strong>1</strong> customer found this useful
                        {% plural %}
                        <strong>{{ num_up_votes }}</strong> customers found this useful
                        {% endblocktrans %}
                        </small>
                    </p>
                {% endif %}
            </div>
        </div>
    </div>
</article>
